<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>订单页面</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<style>
	.pic{
		width: 150px;
		height: 70px;
		margin-top: 0px;
		
	}
	.pic2{
		position: relative;
		width: 75px;
		height: 35px;
		left: 150px;
		top: -40px;
		font-size: 1.6em;
		color: #3B4249;
	}
	#td_n td{
		text-align: center;
	}
	
	.box-footer{
			width:300px;
			height:30px;
			margin-left: 700px; 
	}
	 .box-footer ul>li{
		float: left;
		margin-left: 25px;
	} 
	.form-group{
		margin-left: 100px;
	}
	
</style>
</head>
<body class="pos-r">
	<div class="page-container">
		<div class="pic"><img src="../images/logo.png"></div>	
		<div class="pic2">订单</div>	
		<form action="<%=basePath%>orders/selectAll.do">
			<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
				<input type="hidden" name="uname" value="<%=loginName%>">
				<button type="submit" class="btn btn-danger radius" ><i class="Hui-iconfont">&#9756;</i> 回到首页</button>
			 </div>
		 
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
				    		<th>商品名称</th>
					    	<th>商品图片</th>
					    	<th>商品价格</th>
					    	<th>商品数量</th>
					    	<th>总价</th>
					    	<th width="100px">订单状态</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${orders!=null }">
							<c:forEach items="${orders}" var="os">
				    			<tr>
						    		<th>${os.sname }</th>
						    		<th><img src="${os.picture}" width="100px" height="100px"></th>
						    		<th>${os.price }</th>
						    		<th>${os.gnumber }</th>
						    		<th>${os.gmoney }</th>
						    		<c:if test="${os.order_state==0 }">
						    			<th>未发货</th>
						    		</c:if>
						    		<c:if test="${os.order_state==1 }">
						    			<th>已发货<a class="btn btn-primary radius" href="<%=basePath%>orders/updateState.do?gid=${os.gid}&uname=<%=loginName%>">确认收货</a></th>
						    		</c:if>
									<c:if test="${os.order_state==3}">
					    				<th>确认收货&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary radius" href="<%=basePath%>orders/deleteOrders.do?gid=${os.gid}&uname=<%=loginName%>">删除订单</a></th>
					    			</c:if>
				    			</tr>		
			  			</c:forEach>
					</c:if>
	    			</tbody>
				</table>
			</form>
			<div class="box-footer" >
			<div class="box-ul">
				<ul class="pagination" style="list-style: none;">

					<li><a href="<%=basePath%>orders/queryAll.do?page=${page.firstPage}&uname=<%=loginName%>">首页</a></li>
					<li><a href="<%=basePath%>orders/queryAll.do?page=${page.prePage}&uname=<%=loginName%>">上一页</a></li>

					<li><a href="<%=basePath%>orders/queryAll.do?page=${page.nextPage}&uname=<%=loginName%>">下一页</a></li>
					<li><a href="<%=basePath%>orders/queryAll.do?page=${page.lastPage}&uname=<%=loginName%>">尾页</a></li>
				</ul>
			</div>	
	</div>
		</div>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				//demoIframe.attr("src",treeNode.file + ".html");
				return true;
			}
		}
	}
};		
$(document).ready(function(){
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, zNodes);
	//demoIframe = $("#testIframe");
	//demoIframe.on("load", loadReady);
	var zTree = $.fn.zTree.getZTreeObj("tree");
	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
});

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
	]
});
</script>
</body>
</html>
